<template>
  <div class="login-container">
    <video autoplay muted loop src="@/assets/video.3cf57b17.mp4" />
    <div class="form">
      <el-form ref="loginForm" :model="loginForm" :rules="rules">
        <el-form-item>
          <img src="@/assets/logo1.33ef7fa0.png" alt="">
        </el-form-item>
        <el-form-item prop="account">
          <el-input v-model="loginForm.account" placeholder="账号" />
          <svg-icon icon-class="deng" />
        </el-form-item>
        <el-form-item prop="password">
          <el-input v-model="loginForm.password" placeholder="密码" show-password />
          <svg-icon icon-class="mima" />
        </el-form-item>
        <el-form-item prop="code">
          <el-input v-model="loginForm.code" placeholder="验证码" />
          <svg-icon icon-class="yanzheng" />
          <img src="@/assets/下载.png" class="code-mig" alt="">
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="login">登录</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="login-footer">
      江苏传智播客教育科技股份有限公司
      <span>版权所有Copyright 2006-2022 All Rights Reserved</span>
      <span>苏ICP备16007882号-11</span>
    </div>
  </div>
</template>
<script>
export default {
  name: 'Login',
  data() {
    return {
      loginForm: {
        account: '',
        password: '',
        code: ''
      },
      rules: {
        account: [
          { required: true, message: '请输入用户名', trigger: 'blur' },
          { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
        ],
        password: [
          { required: true, message: '请输入密码', trigger: 'blur' },
          { min: 5, max: 10, message: '长度在 3 到 5 个字符', trigger: 'blur' }
        ],
        code: [
          { required: true, message: '验证码不能为空', trigger: 'blur' }
        ]
      }
    }
  },
  methods: {
    async login() {
      // this.$refs.loginForm.validate((isOK) => {
      //   if (isOK) {
      //     alert('校验通过')
      //   }
      // })
      try {
        await this.$refs.loginForm.validate()
        alert('登录成功')
      } catch (err) {
        console.log(err)
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.login-container{
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  &::before{
    content:'';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1c41;
    opacity: .3;
    z-index: 1;
  }
  video {
    position: absolute;
    display: inline-block;
    width: 100%;
  }
   .form{
    position: absolute;
    top: 45%;
    left: 45%;
    margin: -180px 0 0 -160px;
    width: 450px;
    height: 525px;
    padding: 36px 40px;
    background: #fff;
    border-radius: 10px;
    text-align: center;
    z-index: 99;
    ::v-deep.el-input__inner{
          height: 50px;
          padding-left: 47px;
    }
    ::v-deep.el-button{
    width: 100%;
    height: 54px;
    margin-bottom: 14px;
    margin-top: 22px;
    // background-color: #e15536;
    border: 0;
    font-size: 18px;
    color: #fff;
    font-weight: 700;
    }
    img{
          height: 54px;
          margin: 0 auto;
    }
    .svg-icon{
      position: absolute;
      width: 16px;
      height: 16px;
      left: 14px;
      top: 13px;
    }
    .code-mig{
    display: inline-block;
    width: 71px;
    height: 32px;
    cursor: pointer;
    position: absolute;
    right: 10px;
    top: 9px;
    }
   }
   .login-footer{
    position: fixed;
    bottom: 20px;
    width: 100%;
    text-align: center;
    color: #fff;
    font-size: .85rem;
    line-height: 1rem;
    height: 1rem;
    z-index: 99;
    span{
      margin-left: 20px;
    }
   }
}
</style>
